mini.parse();
var grid=mini.get("datagrid1");//获取表格ID
var tableChClassName=mini.get("tableChClassName");
var code=mini.get("code");

//自动加载初始化方法
$(function () {
    init();
})
//初始化方法
function init() {

    $.ajax({
        url:ajaxUrl + '/sqlAction/findAllFinalDocument.do',
        type:"post",
        success:function (data) {
            console.log(data);
            data3=mini.clone(data);
            data2=mini.clone(data);
            data2.unshift([]);
            grid.setData(data);
            tableChClassName.setData(data2);

        },
        error:function () {

        }
    })
}

function payment() {
    formId = 100;
    $.ajax({
        url: ajaxUrl + "/Coding/addCoding.do",
        type:"post",
        data: {
            formId: formId
        },
        dataType:"json",
        success:function (data) {
            var rows = grid.getSelecteds();
            rows[0].payMentOrderPage[0].coding = data.code;
            rows[0].codingId = data.codingId;
            rows[0].payMentOrderPage[0].documentDate = data.date;
            rows[0].payMentOrderPage[0].documentMaker = data.documentMaker;
            rows[0].clickStatus = "add";
            console.log(rows[0])

            localStorage.setItem("formShow",JSON.stringify(rows[0]));
            var item = {
                iconCls: "fa fa-desktop",
                // id: formId,
                text: "表单展示",
                url: "../pages/Paymentsliplisttwo.html",

            };
            parent.activeTab(item);//与父页面通信
        },
        error:function (message) {
            console.log(message)
        }
    })
}

function search() {
    var tableChClassName=mini.get("tableChClassName").getValue();

    console.log(tableChClassName);
    var code2=mini.get("code").getValue();
    console.log(code2);
    var data=[];
    data.push(tableChClassName,code2);
    console.log(data);
    data=JSON.stringify(data);
    datas=JSON.stringify(data3);
    console.log(data3);
    $.ajax({
        url: ajaxUrl + "/PaymentOrder/findLikes.do",
        type:"post",
        data:{
            data3:datas,
            data:data
        },
        success:function (data) {
            console.log(data);
            grid.setData([]);
            grid.setData(data);

        },
        error:function () {

        }
    })
}